import 'dart:async';

import 'package:flutter/material.dart';
import 'package:json_to_dart/util.dart';

Future inputDialog(context) {
  return showDialog(
    context: context,
    builder: (context) {
      TextEditingController controller = TextEditingController();
      return UnconstrainedBox(
        child: Material(
          type: MaterialType.transparency,
          child: Container(
            width: 300,
            height: 500,
            padding: EdgeInsets.all(10),
            decoration: BoxDecoration(
              color: Colors.white,
              borderRadius: BorderRadius.all(Radius.circular(15)),
            ),
            child: Column(
              children: [
                Expanded(
                  child: TextField(
                    expands: true,
                    autofocus: true,
                    maxLines: null,
                    controller: controller,
                  ),
                ),
                Space(),
                ElevatedButton(
                  onPressed: () => Navigator.of(context).pop(controller.text),
                  child: Text('确定'),
                ),
              ],
            ),
          ),
        ),
      );
    },
  );
}
